<!--
 * @Author: GKN
 * @Date: 2023-10-24 11:53:29
 * @LastEditTime: 2024-01-22 16:56:45
 * @LastEditors: GKN
 * @Description: 
 * @FilePath: \mod\src\view\user\studyjudge\a3.vue
 * 可以输入预定的版权声明、个性签名、空行等
-->
<template>
    <div v-loading="loading">
        <el-form :model="form" label-width="120px" size="large">
            <el-form-item label="主题">
                <el-col :span="24">
                    <el-input placeholder="50字以内" v-model="form.name"/>
                </el-col>
            </el-form-item>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="开始时间">
                        <el-col :span="24">
                            <el-date-picker
                                v-model="form.startTm"
                                type="date"
                                placeholder="选择开始时间"
                                size="large"
                                style="width:100%;"
                                format="YYYY/MM/DD"
                                value-format="YYYY-MM-DD"
                            />
                        </el-col>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="结束时间">
                        <el-col :span="24">
                            <el-date-picker
                                v-model="form.endTm"
                                type="date"
                                placeholder="选择结束时间"
                                size="large"
                                style="width:100%;"
                                format="YYYY/MM/DD"
                                value-format="YYYY-MM-DD"
                            />
                        </el-col>
                    </el-form-item>
                </el-col>
            </el-row>
            
            
            <el-form-item label="行业分类">
                <div class="fl flex flex-w" style="width: 100%;">
                    <div v-for="(item,i) in list_fl2" :key="i" :class="item.select?'active flview':'flview'" @click="click_fl2(i,item.select)">
                        {{item.name}}
                        <span style="margin-left:5px;">|</span>
                    </div>
                </div>
                
            </el-form-item>
            <el-form-item label="电话">
                <el-col :span="24">
                    <el-input v-model="form.phone" placeholder="50字以内"/>
                </el-col>
            </el-form-item>
            <el-form-item label="具体要求">
                <el-col :span="24">
                    <el-input type="textarea" placeholder="100字以内" maxlength="100" :rows="10" show-word-limit v-model="form.mark"/>
                </el-col>
            </el-form-item>
        </el-form>
        <div class="cursor-p btn-submit-1" @click="submit">提交</div>
    </div>
    
</template>

<script setup>
import { ref,reactive,getCurrentInstance } from "vue";
const { proxy } = getCurrentInstance();
import { Plus } from '@element-plus/icons-vue'
    const is_yc= ref(false)
    const form = ref({})
    const loading = ref(false)
    // 分类列表
    const list_fl2 = ref([])
    const getClass=()=>{
        proxy.$http.request(proxy.$api.classlist,'get',{},false, function (res) {
            if(res&&res.data){
                list_fl2.value = []
                res.data.data.list.map((item)=>{
                    list_fl2.value.push({
                        ...item,
                        select:false
                    })
                })
            }
        })
    }
    getClass()
    const click_fl2 = (i,t)=>{
        list_fl2.value.map((item)=>{
            item.select = false
        })
        list_fl2.value[i].select = true
        form.value.cateId = list_fl2.value[i].id
    }
    const submit = ()=>{
        is_yc.value = true
        const data = form.value
        if(!data.startTm){
            proxy.$comJs.msg('error','请填写开始时间')
            return;
        }
        if(!data.endTm){
            proxy.$comJs.msg('error','请填写结束时间')
            return;
        }
        if(!data.name){
            proxy.$comJs.msg('error','请填写主题')
            return;
        }
        if(!data.phone){
            proxy.$comJs.msg('error','请填写电话')
            return;
        }
        if(!data.cateId){
            proxy.$comJs.msg('error','请选择分类')
            return;
        }
        proxy.$http.request(proxy.$api.userJudHy,'post',data,false, function (res) {
            if(res&&res.data){
                if(res.data.code == 0){
                    proxy.$comJs.msg('success','提交成功')
                }
            }
        })
    }
    
</script>

<style lang='less' scoped>
.payType{
    display: flex;
    .item{
        width: 148px;
        height: 56px;
        border:1px solid #e8e8e8;
        display: flex;
        align-items: center;
        margin-right: 15px;
        border-radius: 6px;
        padding: 0 5px;
        img{
            width: 28px;
            height: 20px;
        }
        span{
            color: #8d8d8d;
            font-size: 18px;
            margin-left: 12px;
        }
    }
    .active{
        border:1px solid #fcbdbd;
    }
}
/deep/ .el-input--large .el-input__wrapper{
    padding: 0 0px;
    background:#f6f7f9;
    
}
/deep/ .el-textarea__inner{
    background:#f6f7f9;
    padding: 10px 10px;
}
/deep/.el-input--large .el-input__inner{
    padding:0 10px;
}
::v-deep {

.el-input__inner {
  border: 0;
  border-radius: 0px;

  // &:focus {
  //   border-bottom: 1px solid #409eff;
  // }
}

.el-textarea__inner {
  resize: none;
  /* 这个是去掉 textarea 下面拉伸的那个标志，如下图 */
  border: 0;
  border-radius: 0px;

  // &:focus {
  //   border-bottom: 1px solid #409eff;
  // }
}
}
.avatar-uploader{
    display: flex;
    align-items: flex-end;
    
}
.avatar-uploader .avatar {
  width: 106px;
  height: 106px;
  display: block;
}
.fl{

    .active{
        color: #CF0B00;
    }
    .flview{
        font-size: 14px;
        font-weight: 400;
        cursor: pointer;
        margin-right: 5px;
        line-height: 18px;
    }
}
</style>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
  background:#f6f7f9;
}

.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 106px;
  height: 106px;
  text-align: center;
}
</style>
  
  


